/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-04-18 14:19:35
 * @LastEditTime : 2023-05-21 17:27:04
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\WinningBidder.jsx
 * @Description  :
 */

import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'

export const WinningBidder = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        type: '系统设置',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission?.findIndex(v => v.uuid === '3711cdbc-6ae2-473b-901b-94dab9dfcf8d') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} url={url} type="primary" icon="add" title="新增中标单位" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.tableName, rules: true },
            { ...commonTableList.fullName, rules: false },
            { ...commonTableList.code, rules: true },
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 140,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === 'b7005c18-13b1-40ac-9a69-b50e8091bbfe') !== -1 && (
                            <ModDataButton
                                OptionsEvent={OptionsEvent}
                                key="modify"
                                title="修改"
                                url={url}
                                data={record}
                            />
                        ),
                        Permission.findIndex(v => v.uuid === '1b7696a1-a635-4641-a134-65512d7ea4eb') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="delete"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return data
}
